package com.kai.module_cartoon.widget

import android.view.LayoutInflater
import android.view.ViewGroup
import com.chad.library.adapter.base.binder.QuickViewBindingItemBinder
import com.kai.base.base.basic.extras.load
import com.kai.base.utils.IStringUtils
import com.kai.module_cartoon.databinding.CartoonHorizontalItemBinding

/**
 * @Author: 小强同学
 * @Date:  2021/3/23 12:03
 * @Description:  java类作用描述
 */
class HorizontalAdapter : QuickViewBindingItemBinder<HorizonBean, CartoonHorizontalItemBinding>() {
    override fun convert(holder: BinderVBHolder<CartoonHorizontalItemBinding>, data: HorizonBean) {
        holder.viewBinding.apply {
            chiIm.load(IStringUtils.getString(data.imageUrl))
            chiNameTv.text=IStringUtils.getString(data.textName)
            chiAuthorTv.text=IStringUtils.getString(data.textAuthor)
            chiTv.text=IStringUtils.getString(data.textUrl)
        }
    }

    override fun onCreateViewBinding(layoutInflater: LayoutInflater, parent: ViewGroup, viewType: Int): CartoonHorizontalItemBinding {
       return CartoonHorizontalItemBinding .inflate(layoutInflater, parent, false)
    }
}